package 基础语法.权限修饰符.包1;

public class Test1 {
    public static void main(String[] args) {
        System.out.println(Test1.class);
    }
    public void publicMethod(){}

    protected void protectedMethod() {
        System.out.println(Test1.class + "protectedMethod");
    }

    void naDMethod() {
        System.out.println(Test1.class + "naDMethod");
    }

    private void privateDMethod() {
        System.out.println(Test1.class + "privateDMethod");
    }

    public final void finalMethod() {
        System.out.println(Test1.class + "finalMethod");
    }

}


//效果和单独写在一个文件应该是类似的，都会生成一个单独的class文件
class Test1_1 {//public,abstract,final,无，public 可与,abstract,final,无组合，效果无需多说
    public static void main(String[] args) {
        System.out.println(Test1.class);
    }

    public void  publicMethod(){}
    protected void protectedMethod() {

    }

    void naDMethod() {

    }

    private void privateDMethod() {

    }

    public final void finalMethod() {

    }
}

abstract class Test1_2 {//抽象类只能被继承
    //Test1_2(){}

    Test1_2(int a){

    }
    public static void main(String[] args) {

    }
    abstract void jiji();//必须定义在抽象类中，不能写方法体。子类必须实现,除非子类自身也是一个抽象类
    
    protected void protectedMethod() {

    }

    void naDMethod() {

    }

    private void privateDMethod() {

    }

    public final void finalMethod() {

    }
}

final class Test1_3 {//final不允许被继承
    public static void main(String[] args) {
        System.out.println(Test1.class);
    }

    protected void protectedMethod() {
        System.out.println(Test1.class + "protectedMethod");
    }

    void naDMethod() {
        System.out.println(Test1.class + "naDMethod");
    }

    private void privateDMethod() {
        System.out.println(Test1.class + "privateDMethod");
    }

    public final void finalMethod() {
        System.out.println(Test1.class + "finalMethod");
    }
}

